package org.abluedog.ssfb;

import org.abluedog.ssfb.commands.SSFBCommands;
import org.abluedog.ssfb.listeners.EatListener;
import org.abluedog.ssfb.listeners.SSFBListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.Objects;
import java.util.logging.Logger;

public final class StartSurvivalFromBaby extends JavaPlugin {

    @Override
    public void onEnable() {
        // Plugin startup logic
        this.getLogger().info("Starting Survival-From-Baby");
        this.getConfig().options().copyDefaults();
        this.saveConfig();
        Objects.requireNonNull(getCommand("ssfb")).setExecutor(new SSFBCommands());
        getServer().getPluginManager().registerEvents(new SSFBListener(), this);
        getServer().getPluginManager().registerEvents(new EatListener(), this);
        this.getLogger().info("Enabled Survival-From-Baby");
    }

    @Override
    public void onDisable() {
        // Plugin shutdown logic
    }

    public static Plugin getPlugin() {
        return JavaPlugin.getPlugin(StartSurvivalFromBaby.class);
    }

    public static Logger getPluginLogger() {
        return getPlugin().getLogger();
    }

}
